import router from "@/router";
import {useMenu} from "@/stores/menu";

router.beforeEach(async (to, from, next) => {

    const menuStore = useMenu();
    if (menuStore.isEmptyRouteMenus()) {
        menuStore.initRouteMenus();
        //动态路由添加后，再次跳转，才能够匹配到正确的路由
        next({path: to.path});
        return;
    }

    next();
});